<?php
	defined ('CELL_INDEX') or die ('access denied');
	if ($ID = Fetch ('id')) {
		$Result = pg_affected_rows (pg_query ($PG, 'delete from "Invoices" where "Number" = '.$ID.';'));
		$Error = pg_last_error ($PG);
		ViewSuggest ('invoices');
		if (! $Result) {
			if ($Error) {
				$Message = "Invoice $ID deletion failed: $Error";
			} else $Message = "Invoice $ID deletion failed with no error message.";
		} else $Message = "Invoice $ID deleted successfully.";
		LeaveMessage ($Message);
	}
?>